package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllNafs", query = "select myNaf from Naf myNaf"),
		@NamedQuery(name = "findNafByNafLibelle", query = "select myNaf from Naf myNaf where myNaf.nafLibelle = ?1"),
		@NamedQuery(name = "findNafByNafLibelleContaining", query = "select myNaf from Naf myNaf where myNaf.nafLibelle like ?1"),
		@NamedQuery(name = "findNafByNafNaf", query = "select myNaf from Naf myNaf where myNaf.nafNaf = ?1"),
		@NamedQuery(name = "findNafByNafNafContaining", query = "select myNaf from Naf myNaf where myNaf.nafNaf like ?1"),
		@NamedQuery(name = "findNafByPrimaryKey", query = "select myNaf from Naf myNaf where myNaf.nafNaf = ?1") })
@Table(schema = "GAP", name = "NAF")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "Naf")
public class Naf implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "NAF_NAF", length = 6, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String nafNaf;
	/**
	 */

	@Column(name = "NAF_LIBELLE", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String nafLibelle;

	/**
	 */
	public void setNafNaf(String nafNaf) {
		this.nafNaf = nafNaf;
	}

	/**
	 */
	public String getNafNaf() {
		return this.nafNaf;
	}

	/**
	 */
	public void setNafLibelle(String nafLibelle) {
		this.nafLibelle = nafLibelle;
	}

	/**
	 */
	public String getNafLibelle() {
		return this.nafLibelle;
	}

	/**
	 */
	public Naf() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Naf that) {
		setNafNaf(that.getNafNaf());
		setNafLibelle(that.getNafLibelle());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("nafNaf=[").append(nafNaf).append("] ");
		buffer.append("nafLibelle=[").append(nafLibelle).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((nafNaf == null) ? 0 : nafNaf.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Naf))
			return false;
		Naf equalCheck = (Naf) obj;
		if ((nafNaf == null && equalCheck.nafNaf != null) || (nafNaf != null && equalCheck.nafNaf == null))
			return false;
		if (nafNaf != null && !nafNaf.equals(equalCheck.nafNaf))
			return false;
		return true;
	}
}
